package org.jash.demo04

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import org.jash.comment.BaseActivity
import org.jash.comment.CommentAdapter
import org.jash.demo04.databinding.ActivityMainBinding
import org.jash.demo04.entity.RecommendInfo

class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
    val adapter: CommentAdapter<RecommendInfo> by lazy { CommentAdapter({
        R.layout.item to BR.rec
    }) }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding.recycler.adapter = adapter
        vm.data.observe(this) {
            adapter.addData(*it.toTypedArray())
        }
        vm.load()
    }
}